package com.gary.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 数据权限-菜单树，条件类型枚举
 * <p> Madison.lu </p>
 * <p>Version: 1.0.0</p>
 * <p>Create Date： 2019/11/6 15:44 </p>
 * <p>Copyright (c) 2017 ~ 2019 Allchips版权所有</p>
 */
public enum QueryFilterRuleTreeTypeEnum {


    //否加入权限控: 10 未加入 20 已加入
    CONSTANT(10, "constant", "常量"),
    VARIABLE(20, "variable", "变量"),
    ;

    //状态码
    private int typeCode;
    //状态英文
    private String typeMsgEn;
    //状态中文
    private String typeMsgCn;

    private static final Map<Integer, QueryFilterRuleTreeTypeEnum> lookup = new HashMap<>();

    static {
        for (QueryFilterRuleTreeTypeEnum ase : QueryFilterRuleTreeTypeEnum.values()) {
            lookup.put(ase.getTypeCode(), ase);
        }
    }

    QueryFilterRuleTreeTypeEnum(int typeCode, String typeMsgEn, String typeMsgCn) {
        this.typeCode = typeCode;
        this.typeMsgEn = typeMsgEn;
        this.typeMsgCn = typeMsgCn;
    }

    public int getTypeCode() {
        return typeCode;
    }

    public String getTypeMsgEn() {
        return typeMsgEn;
    }

    public String getTypeMsgCn() {
        return typeMsgCn;
    }

    public static QueryFilterRuleTreeTypeEnum get(Integer typeCode) {
        return lookup.get(typeCode);
    }

}
